<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        //
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')
        //          ->hourly();

        /*// 每日零时执行一次
        $schedule->command('book:calculate-book-total')->daily('00:00');
        // 每日两点执行一次
        $schedule->command('book:cache-user-like-category')->daily('02:00');
        // 每天两次 4点和15点
        $schedule->command('book:order-express-info')->twiceDaily(4,15);
        $schedule->command('book:order-back-express-info')->daily('04:00');
        $schedule->command('book:calculate-user-vip-time')->daily('04:00');*/

        //以下仅供测试环境使用
        $schedule->command('book:calculate-book-total')->hourly();
        $schedule->command('book:cache-user-like-category')->hourly();
        $schedule->command('book:order-express-info')->hourly();
        $schedule->command('book:order-back-express-info')->hourly();
        $schedule->command('book:calculate-user-vip-time')->twiceDaily(4,15);
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}
